import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {LoginComponent} from './user/login/login.component';
import {UserListComponent} from './user/user-list/user-list.component';
import {UserAddComponent} from './user/user-add/user-add.component';

export const routes: Routes = [
  {
    path: '',
    redirectTo: '/login',
    pathMatch: 'full'
  },
  /*{
    path: 'login',
    data: {
      title: '登录',
      status: true
    },
    component: LoginComponent
  },*/
  {
    path: 'userList',
    data: {
      title: '用户列表',
      status: true
    },
    component: UserListComponent
  },
  {
    path: 'userAdd',
    component: UserAddComponent
  },
  {
    path: 'demo',
    loadChildren: './demo/demo.module#DemoModule'
  },
  {
    path: 'loginUser',
    loadChildren: './demo/login/login.module#LoginModule'
  },
  {
    path: 'proLogin',
    loadChildren: './project/login/login.module#LoginModule'
  },
  {
    path: 'top',
    loadChildren: './project/top/top.module#TopModule'
  },
  {
    path: 'left',
    loadChildren: './project/left/left.module#LeftModule'
  },
  {
    path: 'proUserList',
    loadChildren: './project/user-list/user-list.module#UserListModule'
  },
  {
    path: 'login',
    data: {
      title: '登录',
      status: true
    },
    loadChildren: './system/login/login.module#LoginModule'
  },
  {
    path: 'register',
    data: {
      title: '注册',
      status: true
    },
    loadChildren: './system/register/register.module#RegisterModule'
  },
  // 其他不匹配的路由统一跳转到index页面
  {
    path: '**',
    redirectTo: '/proLogin'
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes, {useHash: true})],
  exports: [RouterModule]
})
export class AppRoutingModule {
}
